<template>
  <page-list :x-uri="uri" :doactions="doactions" :custom-components="custom" :checkbox-item="false">
    <!-- 自定义tab -->
    <template v-slot:page-tabs>
      <tabs :course-id="courseId" :tabs="tabs" />
      <page-header :content="headerTitle" />
    </template>
  </page-list>
</template>
<script>
import PageList from '@public/template/page_list.vue';
import Tabs from '../tabs';
import PageHeader from '@/components/page-header';
import User from '@/pages/user/student/account/components/user.vue';
import IsPass from './components/is_pass';
export default {
  components: {
    PageList,
    Tabs,
    PageHeader
  },
  inject: ['reload'],
  data() {
    return {
      headerTitle: '考试记录',
      uri: '/course/admin/exam/' + this.$route.params.id + '/' + this.$route.params.paper_id + '/record/list',
      tabs: [
        {
          title: '考试记录',
          uri: '/course/exam/' + this.$route.params.id + '/' + this.$route.params.paper_id + '/record'
          // meta: { permission: 'course.exam.record' }
        }
      ],
      custom: {
        user: User,
        is_pass: IsPass
      },
      doactions: [{ title: '详情', callback: this.recordDetails }] // meta: { permission: 'course.exam.record' },
    };
  },
  computed: {
    courseId() {
      return this.$route.params.id;
    }
  },
  methods: {
    recordDetails({ row }) {
      const type = {
        1: 'settled',
        2: 'random'
      };
      this.$router.push({ path: '/exam/paper/' + type[row.paper_type] + '/' + row.paper_id + '/record/' + row.id + '/details' });
    }
  }
};
</script>
